<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>vue extend实例构造器</title>
  <script src="../assets/js/vue.js"></script>
</head>
<body>
  <h1>Vue extend实例构造器</h1>
  <hr>
  <!-- Vue.extend都是替换当前挂载的整个DOM节点 -->
  <div id="bindId">bindId</div>
  <author />
  <script>
    var vueExtend = Vue.extend({
      template: "<p><a :href='authorUrl'>{{ authorName }}</a></p>",
      // 这里的data不可直接返回对象，而是通过函数的形式返回对象
      data: function() {
        return {
          authorName: 'jsPang',
          authorUrl: 'http://jspang.com'
        }
      }
    })
    new vueExtend().$mount('#bindId');
    new vueExtend().$mount('author');
  </script>
</body>
</html>